package com.hn.controller;

import com.hn.model.CnUser;
import com.hn.service.CnUserService;
import com.hn.util.IDGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")
public class CnUserController{

    @Autowired
    private CnUserService cnUserService;

    @RequestMapping(value = "/saveUser",method = RequestMethod.POST)
    public String saveCnUserInfo(@RequestBody CnUser cnUser) throws Exception{
        CnUser cnUser1 = new CnUser();
        cnUser1.setId(IDGenerator.uuid());
        cnUser1.setName("张三");
        cnUser1.setLoginName("szl");
        cnUser1.setPwd("123");
        cnUserService.addCnUser(cnUser1);
        return  "save user success";
    }
}
